#ifndef DRAWINGCANVAS_H_
#define DRAWINGCANVAS_H_

#include <oslib/oslib.h>
#include "libs/ArrayList.h"
#include "Object.h"
#include "Color.h"
#include "Drawing.h"
#include <string>
using namespace std;

class DrawingCanvas
{
	protected:
		ArrayList<Drawing> drawings;
		int x,y,w,h;
		bool visible;
		Color bgcolor;
		Drawing background;
		OSL_FONT *font;
		float fsize;
		unsigned short int foptions;
		Color fcolor,fbgcolor;
	public:
		virtual ~DrawingCanvas(){}
		DrawingCanvas();
		DrawingCanvas(int _x, int _y, int _w, int _h);
		
		uint addDrawing(Drawing d);
		Drawing & getDrawing(uint num);
		void removeDrawing(uint num);
		Drawing & setDrawing(uint num, Drawing dval);
		
		void setFont(string fsrc);
		void setFont(OSL_FONT *_font);
		void setFontSize(float _fsize);
		void setFontOptions(unsigned short int _foptions);
		void setFontColor(Color c);
		void setFontBgColor(Color bg);
		
		void setX(int _x);
		void setY(int _y);
		void move(int dx, int dy);
		void moveTo(int _x, int _y);
		void moveTo(Location loc);
		
		OSL_FONT * getFont();
		float getFontSize();
		unsigned short int getFontOptions();
		Color getFontColor();
		Color getFontBgColor();
		
		int getX();
		int getY();
		Location getLocation();
		
		void setWidth(int _w);
		void setHeight(int _h);
		void setSize(int _w, int _h);
		void setSize(Size s);
		
		void setClipping(int _x, int _y, int _w, int _h);
		
		int getWidth();
		int getHeight();
		Size getSize();
		
		void hide();
		void show();
		void setVisibility(bool _visible);
		bool toggleVisibility();
		bool isVisible();
		
		void setColor(Color c);
		void setBackground(Drawing bgdrawing);
		
		Color getColor();
		OSL_COLOR osl_c();
		
		void clear();
		
		void redraw();
		
		virtual string toString();
};
#endif
